package cn.cnnic.uploadkit.bean;

public class FormFile {
	private String fileName;
	private String fileSuffix;
	private String contentType;
	private byte[] data;

	public FormFile() {

	}

	public FormFile(String filePath, String contentType, byte[] data) {
		if (filePath.indexOf("\\") == -1) {
			this.fileName = filePath.substring(filePath.lastIndexOf("\\") + 1);
		} else {
			this.fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
		}

		this.fileSuffix = this.fileName.substring(this.fileName.lastIndexOf(".") + 1);
		this.contentType = contentType;
		this.data = data;
	}

	@Override
	public String toString() {
		return "fileName:" + fileName + ";fileSuffix:" + fileSuffix + ";contentType:" + contentType;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getFileSuffix() {
		return fileSuffix;
	}

	public void setFileSuffix(String fileSuffix) {
		this.fileSuffix = fileSuffix;
	}

	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public byte[] getData() {
		return data;
	}

	public void setData(byte[] data) {
		this.data = data;
	}

}
